
//
//  SetupViewController.m
//  Luxury
//
//  Created by DCQ on 2018/5/19.
//  Copyright © 2018年 ZNXZ. All rights reserved.
//

#import "SetupViewController.h"
#import "SetupCell.h"
#import "UserAgreementViewController.h"

NSString * const  SetupCellIdentifer = @"SetupCellIdentifer";
@interface SetupViewController ()

@end

@implementation SetupViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self setNavigationItemTitle: @"设置"];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
- (void)registerCell{
    
    [self.tableView registerNib:[UINib nibWithNibName:NSStringFromClass([SetupCell class]) bundle:nil] forCellReuseIdentifier:SetupCellIdentifer];
 
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    NSInteger rows = [[self getDefaultData] count];
    
    return rows;
}



-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    CGFloat height = 50;
    
    return height;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    UITableViewCell * cell = nil;
    SetupCell * tempCell = [tableView dequeueReusableCellWithIdentifier:SetupCellIdentifer];
    [tempCell setupTitle:[self getDefaultData][indexPath.row][@"title"]];
    cell = tempCell;
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    return cell;
}
- (NSArray *)getDefaultData{
    NSArray * tempArray = @[@{@"title":@"用户协议" },
                            @{@"title":@"清除缓存" }];
    return tempArray;
    
}


-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.row == 0) {
        [self gotoUserAgreementVC];
    }else if (indexPath.row == 1){
        [self clearCache];
    }
}

- (void)gotoUserAgreementVC{
    
    UserAgreementViewController * tempVC = [[UserAgreementViewController alloc]init];
    [self pushViewController:tempVC];
}

- (void)clearCache{
    
    
 
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
